@extends('layouts.app')

@section('title', '用户列表')

@section('css-import')
<style type="text/css">
	.page-s{
		display: inline-block;
		padding-bottom: 0px;
		margin: 29px 9px;
		border-radius: 4px;
		float:  right;
	}
</style>
@endsection

@section('content-fluid')
<div class="row">
	<!-- BASIC TABLE -->
	<div class="panel">
		<div class="panel-heading">
			<h3 class="panel-title">乐享用户</h3>
		</div>
		<div class="panel-body">
			<form action="/userAll" method="get">
				<ul class="nav nav-pills" style="float:left;">
				  <li role="presentation" class="orderall">
				  	<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
				      搜索条件 <span class="caret"></span>
				    </a>
				    <ul class="dropdown-menu">
				      <li role="presentation" class="yiqucan {{$request->input('t')=='name'?'active':''}}"><a href="javascript:;">昵称</a></li>
				      <li role="presentation" class="weiqucan {{$request->input('t')=='tel'?'active':''}}"><a href="javascript:;">手机号</a></li>
				    </ul>
				  </li>
				</ul>
				<div class="input-group col-md-4 pull-right" style="z-index: auto;">
					<input type="text" value="{{$_GET['t'] ?? ''}}" class="form-control app-search-text" name="s" AUTOCOMPLETE="off" placeholder="搜索用名">
					<input type="hidden" value="name" name="t">
					@foreach($_GET as $k=>$v)
					@if($k!='page' && $k!='t')
					<input type="hidden" value="{{$v}}" name="{{$k}}">
					@endif
					@endforeach
					<span class="input-group-btn"><button type="submit" class="btn btn-primary search-jslx"><i class="fa fa-search"></i></button></span>
				</div>
			</form>
			<table class="table table-hover">
				<thead>
					<tr>
						<th>#</th>
						<th>昵称</th>
						<th>手机号</th>
						<th>最高认证</th>
						<th>账户余额</th>
						<th>积分</th>
						<th>注册时间</th>
						<th>购卡推荐人/次数</th>
						<th>配送</th>
						<th>商圈</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					@foreach($users as $k=>$v)
					<tr>
						<td>{{$v->user_id}}</td>
						<td>{{$v->nicename ?? '未填写'}}</td>
						<td>{{$v->tel}}</td>
						<td>{{$auth_de[$v->reliability]}}</td>
						<td>{{$v->account}}</td>
						<td>{{$v->integral}}</td>
						<td>{{date('Y年m月d日 H:i',$v->insert_time)}}</td>
						<td><a href="/user-details?userid={{$v->share_userid}}">{{$v->share_user_name}}</a>({{$card->orderCount($v->user_id)}})</td>
						<td class="circlename">{{$v->circle_name}}</td>
						<td>{{$v->sucircle_name}}</td>
						<td>
							<a href="/user-details?userid={{$v->user_id}}"><i class="fa fa-info-circle"></i> 查看</a>
						</td>
					</tr>
					@endforeach
				</tbody>
			</table>
			{{$users->appends(['circle_id' => $_GET['circle_id'] ?? '','circle_range_id'=>$_GET['circle_range_id'] ?? ''])->links()}}
			<div class="page-s">本页共{{ $users->count() }}条</div>
			<div class="page-s">共{{ $users->total() }}条</div>
			<div class="page-s">当前第{{ $users->currentPage() }}页</div>
			<div class="page-s">共{{ $users->lastPage() }}页</div>
		</div>
	</div>
	<!-- END BASIC TABLE -->
</div>

@endsection

@section('js-write')
<script type="text/javascript">
	$('.weiqucan').click(function(){
			$('input[name="t"]').val('tel');
			$('input[name="s"]').attr('placeholder','请输入手机号');
		})
	$('.yiqucan').click(function(){
			$('input[name="t"]').val('name');
			$('input[name="s"]').attr('placeholder','请输入昵称');
		})
</script>
@endsection